home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Arsenal
/
OS2 Arsenal v1.0 (Disc 1)(Arsenal Computer).ISO
/
os2_inet
/
tcp20c4.exe
/
BPUBSC1.ZIP
/
DOC
/
rxsocket.inf
(
.txt
)
< prev
Wrap
OS/2 Help File
|
1994-04-12
|
39KB
|
1,485 lines
ΓòÉΓòÉΓòÉ 1. Introduction ΓòÉΓòÉΓòÉ
The REXX Socket Support package provides access to the OS/2 TCP/IP socket
API's. It is assumed you are familiar with the basic socket APIs and that you
can reference the OS/2 specific ones.
References
For information on socket calls, refer to the IBM Transmission Control
Protocol/Internet Protocol Version 2.0 for OS/2: Programmer's Reference.
A widely available book with information on the basic socket APIs is
Internetworking with TCP/IP Volume I: Principals, Protocols, and Architecture
by Douglas Comer.
Requirements
The REXX Socket Support package requires the OS/2 TCP/IP product, version 2.0
or higher.
The REXX feature from the OS/2 Setup and Installation window must be installed.
To access the REXX feature, choose Selective Install from the OS/2 System Setup
folder. Then from the System Configuration window, select OK to display the
OS/2 Setup and Installation window. Check the REXX feature and select the
Install push button.
ΓòÉΓòÉΓòÉ 2. Installation ΓòÉΓòÉΓòÉ
The REXX Socket Support package is contained in the file rxsock.dll. This
dynamic link library (DLL) needs to be placed in a directory listed in your
LIBPATH statement in your CONFIG.SYS file. To get access to the functions in
the REXX Socket Support package, execute the following REXX code:
rc = RxFuncAdd("SockLoadFuncs","rxSock","SockLoadFuncs")
rc = SockLoadFuncs()
To unload the DLL, you should first call the SockDropFuncs() function, then
exit all CMD.EXE shells. After exiting all the command shells, the DLL will be
dropped by OS/2 and can be deleted or replaced.
ΓòÉΓòÉΓòÉ 3. Parameters, Return Values, and Parameters Set ΓòÉΓòÉΓòÉ
Select an item:
Parameters
socket
domain
address
dotAddress
host
Return Values
Variables Set
errno
h_errno
ΓòÉΓòÉΓòÉ <hidden> Return Values ΓòÉΓòÉΓòÉ
Return values for most functions are the same as the C equivalents, unless
otherwise noted.
ΓòÉΓòÉΓòÉ <hidden> socket Parameter ΓòÉΓòÉΓòÉ
The socket parameter is the socket value. It is an integer number that is
returned from SockSocket().
ΓòÉΓòÉΓòÉ <hidden> domain Parameter ΓòÉΓòÉΓòÉ
The domain parameter is the domain value. The only supported domain is
"AF_INET".
ΓòÉΓòÉΓòÉ <hidden> address Parameter ΓòÉΓòÉΓòÉ
The address parameter is the 'stem' of a stemmed variable with the following
values:
address.family
always set this to "AF_INET"
address.port
a port number
address.addr
a dotted decimal address, or where appropriate, INADDR_ANY
When the address parameter is needed, you should set it to the name of a stem
variable for the function to set (or that the function will read from). For
example, if you passed the string "xxx.!" as a parameter, the following
variables will be set by the function, or queried by the function:
"xxx.!family"
"xxx.!port"
"xxx.!addr"
Related Topic
Notes on stemmed variables
ΓòÉΓòÉΓòÉ <hidden> dotAddress Parameter ΓòÉΓòÉΓòÉ
The dotAddress is the standard dotted decimal address. For example, the
following string is a valid address:
"9.23.19.63"
ΓòÉΓòÉΓòÉ <hidden> host Parameter ΓòÉΓòÉΓòÉ
The host parameter is the 'stem' of a stemmed variable with the following
values:
host.name
the standard name of the host
host.alias.0
the number of aliases for this host
host.alias.1
the first alias for this host
host.alias.n
the n'th alias for this host
host.addrtype
always set this to "AF_INET"
host.addr
a dotted decimal address (default address)
host.addr.0
the number of addresses for this host
host.addr.1
the first address for this host
host.addr.n
the n'th address for this host
When the host parameter is needed, you should set it to the name of a stem
variable for the function to set (or that the function will read from). For
example, if you passed the string "xxx.!" as a parameter, the following
variables will be set by the function, or queried by the function:
"xxx.!name"
"xxx.!alias.0", "xxx.!alias.1" ... "xxx.!alias.n"
"xxx.!addrtype"
"xxx.!addr"
"xxx.!addr.0", "xxx.!addr.1" ... "xxx.!addr.n"
Related Topic
Notes on stemmed variables
ΓòÉΓòÉΓòÉ <hidden> Notes on Stemmed Variables ΓòÉΓòÉΓòÉ
The address parameter and host parameters are stemmed variable names. The
SockSelect() call also has stemmed variables.
Traditionally, you would pass a string like "addr." as a parameter, and expect
to have the variables addr.family, addr.port, and addr.addr set by the
function. In the examples given in this document, stems like "addr.!" are
used. The exclamation point helps to distinguish the tail values, so they will
not be used as normal variables.
For example, with the following code you might expect the say statement to
write the port number of the accepted socket. Instead it writes the value of
the variable addr.923, since the port variable is set to a value.
port = 923
sNew = SockAccept(sOld,"addr.")
say addr.port
Since you normally do not use an exclamation point in your variables, it's
unlikely that you will be using the variable "!port" in your program.
Also note, some programmers prefer other characters, including "_", "0", and
"1". The digits are allowed to prefix tail values and are very secure against
this kind of accidental misuse. However, the digit characters are hard to
distinguish from O, I, and l.
ΓòÉΓòÉΓòÉ <hidden> errno Variable ΓòÉΓòÉΓòÉ
The errno variable is set after every REXX Socket Support (rxSock) function
call. The value of 0 indicates no error occurred.
The value is set even if the C API that the REXX function callc does not set
the variable. In that case, the value has no meaning.
The errno variable will have one of the following values (or a numeric value if
the number is not one of these values):
"EWOULDBLOCK"
"EINPROGRESS"
"EALREADY"
"ENOTSOCK"
"EDESTADDRREQ"
"EMSGSIZE"
"EPROTOTYPE"
"ENOPROTOOPT"
"EPROTONOSUPPORT"
"ESOCKTNOSUPPORT"
"EOPNOTSUPP"
"EPFNOSUPPORT"
"EAFNOSUPPORT"
"EADDRINUSE"
"EADDRNOTAVAIL"
"ENETDOWN"
"ENETUNREACH"
"ENETRESET"
"ECONNABORTED"
"ECONNRESET"
"ENOBUFS"
"EISCONN"
"ENOTCONN"
"ESHUTDOWN"
"ETOOMANYREFS"
"ETIMEDOUT"
"ECONNREFUSED"
"ELOOP"
"ENAMETOOLONG"
"EHOSTDOWN"
"EHOSTUNREACH"
"ENOTEMPTY"
ΓòÉΓòÉΓòÉ <hidden> h_errno Variable ΓòÉΓòÉΓòÉ
The h_errno variable is set after every REXX Socket Support (rxSock) function
call. The value of 0 indicates no error occurred.
The value is set even if the C API that the REXX function calls does not set
the variable. In that case, the value has no meaning.
The h_errno variable will have one of the following values (or a numeric value
if the number is not one of these values):
"HOST_NOT_FOUND"
"TRY_AGAIN"
"NO_RECOVERY"
"NO_ADDRESS"
ΓòÉΓòÉΓòÉ 4. Functions ΓòÉΓòÉΓòÉ
Most of the functions correspond to their like-named C functions available in
the OS/2 TCP/IP socket library.
Initialization Functions
SockLoadFuncs() SockDropFuncs() SockVersion()
SockInit()
Socket Connections Functions
SockAccept() SockBind() SockConnect()
SockClose() SockSoClose() SockListen()
SockShutDown() SockSocket()
Address and Name Functions
SockGetHostByAddr() SockGetHostByName() SockGetHostID()
SockGetPeerName() SockGetSockName()
Sending and Receiving Functions
SockRecv() SockRecvFrom() SockSelect()
SockSend() SockSendTo()
Socket Options Functions
SockSetSockOpt() SockGetSockOpt()
Error Functions
SockPSock_Errno() SockSock_Errno()
Commands Function
SockIoctl()
ΓòÉΓòÉΓòÉ <hidden> Initialization ΓòÉΓòÉΓòÉ
SockLoadFuncs()
SockDropFuncs()
SockVersion()
SockInit()
Calls by Task
ΓòÉΓòÉΓòÉ <hidden> Connections ΓòÉΓòÉΓòÉ
SockAccept()
SockBind()
SockConnect()
SockClose()
SockSoClose()
SockListen()
SockShutDown()
SockSocket()
Calls by Task
ΓòÉΓòÉΓòÉ <hidden> Address/Name ΓòÉΓòÉΓòÉ
SockGetHostByAddr()
SockGetHostByName()
SockGetHostID()
SockGetPeerName()
SockGetSockName()
Calls by Task
ΓòÉΓòÉΓòÉ <hidden> Send/Receive ΓòÉΓòÉΓòÉ
SockRecv()
SockRecvFrom()
SockSelect()
SockSend()
SockSendTo()
Calls by Task
ΓòÉΓòÉΓòÉ <hidden> Options ΓòÉΓòÉΓòÉ
SockSetSockOpt()
SockGetSockOpt()
Calls by Task
ΓòÉΓòÉΓòÉ <hidden> Errors ΓòÉΓòÉΓòÉ
SockPSock_Errno()
SockSock_Errno()
Calls by Task
ΓòÉΓòÉΓòÉ <hidden> Commands ΓòÉΓòÉΓòÉ
SockIoctl()
Calls by Task
ΓòÉΓòÉΓòÉ 4.1. SockAccept() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockAccept() ΓòÉΓòÉΓòÉ
/* Implements the C function accept() */
socket = SockAccept(socket<,address>)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockAccept() ΓòÉΓòÉΓòÉ
The SockAccept() call implements the C function accept().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockAccept() ΓòÉΓòÉΓòÉ
socket
address (optional)
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockAccept() ΓòÉΓòÉΓòÉ
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.2. SockBind() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockBind() ΓòÉΓòÉΓòÉ
/* Implements the C function bind() */
rc = SockBind(socket,address)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockBind() ΓòÉΓòÉΓòÉ
The SockBind() call implements the C function bind().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockBind() ΓòÉΓòÉΓòÉ
socket
address
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockBind() ΓòÉΓòÉΓòÉ
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.3. SockClose() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockClose() ΓòÉΓòÉΓòÉ
/* Implements the TCP/IP C API function
soclose() */
rc = SockClose(socket)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockClose() ΓòÉΓòÉΓòÉ
The SockClose() call implements the TCP/IP C API function soclose().
The SockClose() call is exactly the same as the SockSoClose() call.
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockClose() ΓòÉΓòÉΓòÉ
socket
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockClose() ΓòÉΓòÉΓòÉ
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.4. SockConnect() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockConnect() ΓòÉΓòÉΓòÉ
/* Implements the C function
connect() */
rc = SockConnect(socket,address)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockConnect() ΓòÉΓòÉΓòÉ
The SockConnect() call implements the C function connect().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockConnect() ΓòÉΓòÉΓòÉ
socket
address
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockConnect() ΓòÉΓòÉΓòÉ
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.5. SockDropFuncs() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockDropFuncs() ΓòÉΓòÉΓòÉ
/* Drops all functions in the REXX
Socket Support package */
rc = SockDropFuncs()
ΓòÉΓòÉΓòÉ <hidden> Definition for SockDropFuncs() ΓòÉΓòÉΓòÉ
The SockDropFuncs() call drops all the functions in the REXX Socket Support
package.
To unload the DLL, you should first call the SockDropFuncs() function, then
exit all CMD.EXE shells. After exiting all the command shells, the DLL will be
dropped by OS/2 and can be deleted or replaced.
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockDropFuncs() ΓòÉΓòÉΓòÉ
none
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockDropFuncs() ΓòÉΓòÉΓòÉ
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.6. SockGetHostByAddr() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockGetHostByAddr() ΓòÉΓòÉΓòÉ
/* Implements the C function
gethostbyaddr() */
rc = SockGetHostByAddr(dotAddress,host<,domain>)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockGetHostByAddr() ΓòÉΓòÉΓòÉ
The SockGetHostByAddr() call implements the C function gethostbyaddr().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockGetHostByAddr() ΓòÉΓòÉΓòÉ
dotAddress
host
domain (optional)
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockGetHostByAddr() ΓòÉΓòÉΓòÉ
1 when SockGetHostByAddr() is successful.
0 when SockGetHostByAddr() has an error.
ΓòÉΓòÉΓòÉ 4.7. SockGetHostByName() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockGetHostByName() ΓòÉΓòÉΓòÉ
/* Implements the C function
gethostbyname() */
rc = SockGetHostByName(nameAddress,host)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockGetHostByName() ΓòÉΓòÉΓòÉ
The SockGetHostByName() call implements the C function gethostbyname().
The nameAddress should be the textual name of a host. For example:
"chris.vnet.ibm.com"
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockGetHostByName() ΓòÉΓòÉΓòÉ
nameAddress - the textual name of a host. For example:
"chris.vnet.ibm.com"
host
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockGetHostByName() ΓòÉΓòÉΓòÉ
1 when SockGetHostByName() is successful.
0 when SockGetHostByName() has an error.
ΓòÉΓòÉΓòÉ 4.8. SockGetHostId() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockGetHostId() ΓòÉΓòÉΓòÉ
/* Implements the C function
gethostid() */
dotAddress = SockGetHostId()
ΓòÉΓòÉΓòÉ <hidden> Definition for SockGetHostId() ΓòÉΓòÉΓòÉ
The SockGetHostId() call implements the C function gethostid().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockGetHostId() ΓòÉΓòÉΓòÉ
none
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockGetHostId() ΓòÉΓòÉΓòÉ
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.9. SockGetPeerName() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockGetPeerName() ΓòÉΓòÉΓòÉ
/* Implements the C function
getpeername() */
rc = SockGetPeerName(socket,address)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockGetPeerName() ΓòÉΓòÉΓòÉ
The SockGetPeerName() call implements the C function getpeername().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockGetPeerName() ΓòÉΓòÉΓòÉ
socket
address
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockGetPeerName() ΓòÉΓòÉΓòÉ
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.10. SockGetSockName() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockGetSockName() ΓòÉΓòÉΓòÉ
/* Implements the C function
getsockname() */
rc = SockGetSockName(socket,address)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockGetSockName() ΓòÉΓòÉΓòÉ
The SockGetSockName() call implements the C function getsockname().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockGetSockName() ΓòÉΓòÉΓòÉ
socket
address
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockGetSockName() ΓòÉΓòÉΓòÉ
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.11. SockGetSockOpt() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockGetSockOpt() ΓòÉΓòÉΓòÉ
/* Implements the C function
getsockopt() */
rc = SockGetSockOpt(socket,level,optVar,optVal)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockGetSockOpt() ΓòÉΓòÉΓòÉ
The SockGetSockOpt() call implements the C function getsockopt().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockGetSockOpt() ΓòÉΓòÉΓòÉ
socket
level - "SOL_SOCKET" is the only valid value.
optVar - contains one of the following values after the call is made:
"SO_BROADCAST"
"SO_DEBUG"
"SO_DONTROUTE"
"SO_ERROR"
"SO_KEEPALIVE"
"SO_LINGER"
"SO_OOBINLINE"
"SO_RCVBUF"
"SO_RCVLOWAT"
"SO_RCVTIMEO"
"SO_REUSEADDR"
"SO_SNDBUF"
"SO_SNDLOWAT"
"SO_SNDTIMEO"
"SO_TYPE"
"SO_USELOOPBACK"
optVal - the value of the option. Generally, the values for optVal are
integers. The exceptions are:
"SO_LINGER"
expects two blank delimited integers. The first is the l_onoff value and
the second is the l_linger value.
"SO_TYPE"
a string of either "STREAM", "DGRAM", or "RAW"
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockGetSockOpt() ΓòÉΓòÉΓòÉ
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.12. SockInit() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockInit() ΓòÉΓòÉΓòÉ
/* Implements the C function
sock_init() */
rc = SockInit()
ΓòÉΓòÉΓòÉ <hidden> Definition for SockInit() ΓòÉΓòÉΓòÉ
The SockInit() call implements the C function sock_init().
For each REXX Socket Support (rxSock) function call, initialization is done if
initialization has not yet occurred. Therefore, the SockInit() call is not
needed.
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockInit() ΓòÉΓòÉΓòÉ
none
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockInit() ΓòÉΓòÉΓòÉ
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.13. SockIoctl() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockIoctl() ΓòÉΓòÉΓòÉ
/* Implements the C function ioctl() */
rc = SockIoctl(socket,ioctlCmd,ioctlData)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockIoclt() ΓòÉΓòÉΓòÉ
The SockIoclt() call implements the C function ioclt().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockIoclt() ΓòÉΓòÉΓòÉ
socket
ioctlCmd - the ioctl command to perform. The valid commands are:
"FIONBIO"
"FIONREAD"
ioctlData - the command specific value. The valid values are:
"FIONBIO" - "1" or "0"
"FIONREAD" - name of a variable to
contain the number of
readable bytes
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockIoclt() ΓòÉΓòÉΓòÉ
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.14. SockListen() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockListen() ΓòÉΓòÉΓòÉ
/* Implements the C function listen() */
rc = SockListen(socket,backlog)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockListen() ΓòÉΓòÉΓòÉ
The SockListen() call implements the C function listen().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockListen() ΓòÉΓòÉΓòÉ
socket
backlog - maximum length for the queue of pending connections.
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockListen() ΓòÉΓòÉΓòÉ
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.15. SockLoadFuncs() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockLoadFuncs() ΓòÉΓòÉΓòÉ
/* Loads all functions in the REXX
Socket Support package */
rc = SockLoadFuncs()
ΓòÉΓòÉΓòÉ <hidden> Definition for SockLoadFuncs() ΓòÉΓòÉΓòÉ
The SockLoadFuncs() call loads all the functions in the REXX Socket Support
package.
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockLoadFuncs() ΓòÉΓòÉΓòÉ
SockLoadFuncs() - If any parameters are passed to this function, it will bypass
the copyright information that is normally displayed.
All parameters are ignored (except to determine whether or not to bypass
displaying the information).
ΓòÉΓòÉΓòÉ <hidden> Return Values for ΓòÉΓòÉΓòÉ
SockLoadFuncs()
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.16. SockPSock_Errno() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockPSock_Errno() ΓòÉΓòÉΓòÉ
/* Implements the C function
psock_errno() */
SockPSock_Errno(<error_string>)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockPSock_Errno() ΓòÉΓòÉΓòÉ
The SockPSock_Errno() call implements the C function psock_errno().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockPSock_Errno() ΓòÉΓòÉΓòÉ
error_string (optional)
The error string that is written to the standard error device. It describes
the last error encountered.
The output to the standard error device has the following format:
the error string
a colon
a space
the error message from sock_errno()
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockPSock_Errno() ΓòÉΓòÉΓòÉ
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.17. SockRecv() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockRecv() ΓòÉΓòÉΓòÉ
/* Implements the C function recv() */
rc = SockRecv(socket,var,len<,flags>)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockRecv() ΓòÉΓòÉΓòÉ
The SockRecv call implements the C function recv().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockRecv() ΓòÉΓòÉΓòÉ
socket
var
name of a REXX variable that data should be received into.
len
maximum amount of data to read.
flags (optional)
a blank delimited list of options. The options are: "MSG_OOB" and
"MSG_PEEK".
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockRecv() ΓòÉΓòÉΓòÉ
Returns the return code from the recv() function.
ΓòÉΓòÉΓòÉ 4.18. SockRecvFrom() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockRecvFrom() ΓòÉΓòÉΓòÉ
/* Implements the C function recvfrom() */
rc = SockRecvFrom(socket,var,len<,flags>,address)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockRecvFrom() ΓòÉΓòÉΓòÉ
The SockRecvFrom call implements the C function recvfrom().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockRecvFrom() ΓòÉΓòÉΓòÉ
socket
var
name of a REXX variable that data should be received into.
len
maximum amount of data to read.
flags (optional)
a blank delimited list of options. The options are: "MSG_OOB" and
"MSG_PEEK".
address
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockRecvFrom() ΓòÉΓòÉΓòÉ
Returns the return code from the recvfrom() C function.
ΓòÉΓòÉΓòÉ 4.19. SockSelect() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockSelect() ΓòÉΓòÉΓòÉ
/* Implements the C function select() */
rc = SockSelect(reads,writes,excepts<,timeout>)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockSelect() ΓòÉΓòÉΓòÉ
The SockSelect call implements the C function select().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockSelect() ΓòÉΓòÉΓòÉ
reads,writes,excepts
The reads, writes, and excepts parameters are stem variables which are queried
and set by this function. The stem.0 variable should contain the number of
sockets, stem.1 the first socket, etc. Upon return, the stem variables will be
reset to the sockets which are ready. For example:
r.0 = 2
r.1 = 101
r.2 = 102
w.0 = 1
w.1 = 103
e.0 = 0
rc = SockSelect("r.","w.","e.")
do i = 1 to r.0
say "socket" r.i "is ready for reading."
end
If any of the stem variables are "", no parameter is passed and no sockets for
that type will be checked. For example, the SockSelect() call above could have
been invoked as either:
rc = SockSelect("r.","w.","")
rc = SockSelect("r.","w.",)
timeout
The timeout parameter is the number of seconds to wait before timing out. The
number must be integer. For no waiting, use a value of 0. To wait
indefinitely, use "".
If no timeout value is passed, "" is assumed. Non-numeric and negative numbers
are considered 0.
The function call SockSelect(,,,3) results in the program pausing for 3
seconds.
Related Topic
Notes on stemmed variables
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockSelect() ΓòÉΓòÉΓòÉ
The return value from SockSelect() is the number of ready sockets.
If a timeout occurred, a value of 0 is returned and the socket arrays are not
modified.
ΓòÉΓòÉΓòÉ 4.20. SockSend() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockSend() ΓòÉΓòÉΓòÉ
/* Implements the C function send() */
rc = SockSend(socket,data<,flags>)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockSend() ΓòÉΓòÉΓòÉ
The SockSend call implements the C function send().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockSend() ΓòÉΓòÉΓòÉ
socket
data
a string of text to be sent on the sock.
flags (optional)
a blank delimited list of options. The options are: "MSG_OOB" and
"MSG_DONTROUTE".
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockSend() ΓòÉΓòÉΓòÉ
Returns the return code from the send() C function.
ΓòÉΓòÉΓòÉ 4.21. SockSendTo() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockSendTo() ΓòÉΓòÉΓòÉ
/* Implements the C function sendto() */
rc = SockSendTo(socket,data<,flags>,address)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockSendTo() ΓòÉΓòÉΓòÉ
The SockSendTo() call implements the C function sendto().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockSendTo() ΓòÉΓòÉΓòÉ
socket
data
a string of text to be sent on the sock.
flags (optional)
the only option is "MSG_DONTROUTE".
address
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockSendTo() ΓòÉΓòÉΓòÉ
Returns the return code from the sendto() C function.
ΓòÉΓòÉΓòÉ 4.22. SockSetSockOpt() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockSetSockOpt() ΓòÉΓòÉΓòÉ
/* Implements the C function
setsockopt() */
rc = SockSetSockOpt(socket,level,optVar,optVal)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockSetSockOpt() ΓòÉΓòÉΓòÉ
The SockSetSockOpt() call implements the C function setsockopt().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockSetSockOpt() ΓòÉΓòÉΓòÉ
socket
level - "SOL_SOCKET" is the only valid value.
optVar - the values are:
"SO_BROADCAST"
"SO_DEBUG"
"SO_DONTROUTE"
"SO_KEEPALIVE"
"SO_LINGER"
"SO_OOBINLINE"
"SO_RCVBUF"
"SO_RCVLOWAT"
"SO_RCVTIMEO"
"SO_REUSEADDR"
"SO_SNDBUF"
"SO_SNDLOWAT"
"SO_SNDTIMEO"
"SO_USELOOPBACK"
optVal - the value of the option. Generally, the values for optVal are
integers. The exceptions are:
"SO_LINGER"
expects two blank delimited integers. The first is the l_onoff value and
the second is the l_linger value.
"SO_TYPE"
a string of either "STREAM", "DGRAM", or "RAW"
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockSetSockOpt() ΓòÉΓòÉΓòÉ
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.23. SockShutDown() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockShutDown() ΓòÉΓòÉΓòÉ
/* Implements the C function
shutdown() */
rc = SockShutDown(socket,how)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockShutDown() ΓòÉΓòÉΓòÉ
The SockShutDown() call implements the C function shutdown().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockShutDown() ΓòÉΓòÉΓòÉ
socket
how - identifies the condition of the shutdown. The values are:
0 ends communication from the socket.
1 ends communication to the socket.
2 ends communication both from and to the socket.
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockShutDown() ΓòÉΓòÉΓòÉ
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.24. SockSock_Errno() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockSock_Errno() ΓòÉΓòÉΓòÉ
/* Implements the C function
sock_errno() */
errno = SockSock_Errno()
ΓòÉΓòÉΓòÉ <hidden> Definition for SockSock_Errno() ΓòÉΓòÉΓòÉ
The SockSock_Errno() call implements the C function sock_errno().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockSock_Errno() ΓòÉΓòÉΓòÉ
none
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockSock_Errno() ΓòÉΓòÉΓòÉ
errno
the numerical error value of last error that occurred.
ΓòÉΓòÉΓòÉ 4.25. SockSocket() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockSocket() ΓòÉΓòÉΓòÉ
/* Implements the C function socket() */
socket = SockSocket(domain,type,protocol)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockSocket() ΓòÉΓòÉΓòÉ
The SockSocket() call implements the C function socket().
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockSocket() ΓòÉΓòÉΓòÉ
domain
type
may be "SOCK_STREAM", "SOCK_DGRAM", or "SOCK_RAW".
protocol
may be "IPPROTO_UDP", "IPPROTO_TCP", or "0".
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockSocket() ΓòÉΓòÉΓòÉ
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.26. SockSoClose() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockSoClose() ΓòÉΓòÉΓòÉ
/* Implements the C function soclose() */
rc = SockSoClose(socket)
ΓòÉΓòÉΓòÉ <hidden> Definition for SockSoClose() ΓòÉΓòÉΓòÉ
The SockSoClose() call implements the C function soclose().
The SockSoClose() call is exactly the same as the SockClose() call.
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockSoClose() ΓòÉΓòÉΓòÉ
socket
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockSoClose() ΓòÉΓòÉΓòÉ
Returns the same values as the C API call.
ΓòÉΓòÉΓòÉ 4.27. SockVersion() ΓòÉΓòÉΓòÉ
Select an item:
Syntax
Parameters
Return Values
Definition
Related Calls
ΓòÉΓòÉΓòÉ <hidden> Syntax for SockVersion() ΓòÉΓòÉΓòÉ
/* Identifies the version of the REXX
Socket Support package */
vers = SockVersion()
ΓòÉΓòÉΓòÉ <hidden> Definition for SockVersion() ΓòÉΓòÉΓòÉ
The SockVersion() call identifies the version of the REXX Socket Support
package. The current version is 2.0.
ΓòÉΓòÉΓòÉ <hidden> Parameters for SockVersion() ΓòÉΓòÉΓòÉ
none
ΓòÉΓòÉΓòÉ <hidden> Return Values for SockVersion() ΓòÉΓòÉΓòÉ
Returns the REXX Socket Support package version number.